<template>
  <div  v-bind:style="{height: height}">
  	<template v-if="user.uname!=null && user.uname!='' &&   user.uname!=undefined">
  		<tdhead></tdhead>
  	</template>
		<transition>
			<router-view></router-view>
		</transition>
	</div>
</template>

<script>
	import tdhead from "./modules/home/components/tdhead";
	export default {
		name: 'App',
		components: {
			tdhead
		},
		data() {
			return {
			
			}
		},
		computed: {
			user: function() {
				return this.$store.state.app.user;
			},
			height:function(){
				return window.screen.height+"px";
			}
		},
		mounted(){
			this.gotowhere();
			
		},
		methods: {
			gotowhere(){
				var path=this.$route.path;
				if(path.indexOf("newstu")>-1){
					return;
				}
				if(this.user.uname!=null && this.user.uname!=undefined && this.user.uname!=""){
					var usid=sessionStorage.getItem('usid');
					var zw=sessionStorage.getItem('zw');
					var dlzh=sessionStorage.getItem('dlzh');
					var sex=sessionStorage.getItem('sex');
					var nj=sessionStorage.getItem('nj');
					var bj=sessionStorage.getItem('bj');
					var year=sessionStorage.getItem('year');
					var jsessionid=sessionStorage.getItem('jsessionid');
					var uname=sessionStorage.getItem('uname');
					var permission=sessionStorage.getItem('permission');
					var name=sessionStorage.getItem('name');
					if(usid){
						var userinfo={
							usid,
							zw,
							dlzh,
							sex,
							nj,
							bj,
							year,
							jsessionid,
							uname,
							permission,
							name
						}
						this.$store.commit("setUser", userinfo);
					}else{
						this.$router.push({
							path: "/login"
						});
					}	
				}else{
					this.$router.push({
						path: "/login"
					});
				}
			}
		}
	}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
